/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hu.tozo.service;

import hu.tozo.facade.GlassfishFacade;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import javax.ejb.LocalBean;
import javax.ejb.Schedule;
import javax.ejb.Singleton;
import javax.ejb.Stateless;

/**
 *
 * @author tozo
 */
@Singleton
@LocalBean
public class MonitoringService {

    //Algoritmus:
    //Minden gepre belep sorban
    //A begyujtott adatokrol atlagot szamol
    //Majd beadja a dontes tamogatonak
    //A kimenete, hogy inditani vagy leallitani kell gepet.
    @Schedule(minute = "*", second = "0", dayOfMonth = "*", month = "*", year = "*", hour = "*", dayOfWeek = "*")
    public void myTimer() throws UnsupportedEncodingException, Exception {
        //System.out.println("Timer event: " + new Date());
        /*GlassfishFacade gf  = new GlassfishFacade();
        EC2Service      ec2 = new EC2Service();
        List instances = ec2.getAllClusterInstanceIP(16);
        for (Iterator it = instances.iterator(); it.hasNext();) {
            String publicDNS = (String) it.next();
            gf.setIpAddress(publicDNS);
            gf.runTask("CPULoad");
            String terheles = gf.getKimenet();
            float teher = Float.parseFloat(terheles);
            System.out.println("Kimenet:"+teher);            
        }*/
        //gf.setIpAddress("10.252.192.3");
        //gf.runTask("CPULoad");
    }
}
